import matplotlib.pyplot as plt
import math
# 表格数据
methods = ['岭回归', 'BP神经网络', '基于决策树的自适应高阶拟合算法']
y1=[89950.511, 168.041, 1121.365, 11035.039, 208922.481,0.091, 14.327]
y2=[8209.993, 240.120, 120.975, 1569.5985, 141168.375,0.040, 53.206]
y3=[1911.705, 6.165, 9.192, 1160.623, 3764.674,0.014, 1.749]
# X轴标签
x_labels = ['y1', 'y2', 'y3', 'y4', 'y5', 'y6', 'y7']
plt.rcParams['font.sans-serif'] = ['SimHei']  # 使用黑体
plt.rcParams['axes.unicode_minus'] = False   # 正常显示负号
# 绘制折线图
plt.figure(figsize=(10, 6))

plt.plot(x_labels, y1, marker='o', label=methods[0])
plt.plot(x_labels, y2, marker='o', label=methods[1])
plt.plot(x_labels, y3, marker='o', label=methods[2])

plt.xlabel('拟合函数')
plt.ylabel('均方误差')
plt.title('不同模型的均方误差指标对比')
plt.legend()
plt.grid(True)
plt.show()